@extends('admin.layout.layout', ['row' => @$page])

@section('contain')


    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <x-portlet-breadcrumb :page="$page"></x-portlet-breadcrumb>
            </div>
            <div class="actions">
                {{--<div class="item">
                    <a href="/{{ request()->path() }}/create" class="btn btn-sm btn-primary">{{ ts('addnew') }}</a>
                </div>--}}
            </div>
        </div>

        <div class="my-3 bg-light p-3 px-4">
            <div class="row">
                <div class="col-auto">
                    <b>{{ ts('sequence') }}</b>：
                    <span>{{ @$data->id }}</span>
                </div>
                <div class="col-auto">
                    <b>{{ ts('filmtype') }}</b>：
                    <span>{{ ts('film_type_master.'.@$data->film_type_id) }}</span>
                </div>
                <div class="col-auto">
                    <b>{{ ts('rolllength') }}</b>：
                    <span>{{ @$data->length }}</span>
                </div>
                <div class="col-auto">
                    <b>{{ ts('rollnumber') }}</b>：
                    <span>{{ @$data->roll_number }}</span>
                </div>
                <div class="col-auto">
                    <b>{{ ts('dateentered') }}</b>：
                    <span>{{ @$data->date_entered }}</span>
                </div>
            </div>
        </div>

        <div>
            <h3 class="section_sub_title">{{ ts('ALLOCATEDRECORD') }}</h3>
            <table class="table table-s2 text-center">
                <thead>
                <tr>
                    <th>{{ ts('sequence') }}</th>
                    <th>{{ ts('length') }}</th>
                    <th>{{ ts('SOLDTO') . '' . ts('USERTYPE') }}</th>
                    <th>{{ ts('SOLDTO') }}</th>
                    <th>{{ ts('soldby') }}</th>
                    <th>{{ ts('dateentered') }}</th>
                </tr>
                </thead>
                <tbody>
                @foreach(\App\Models\RollSales::where('roll_id', $data->id)->orderByDesc('id')->get() as $v)
                    <tr>
                        <td>{{ @$v->id }}</td>
                        <td>{{ @$v->length }}</td>
                        <td>{{ @$v->sold_to_user->user_type }}</td>
                        <td>{{ @$v->sold_to_user->user_type == 3 ?: @$v->sold_to_user->company_name }}</td>
                        <td>{{ @$v->sold_by_user->company_name }}</td>
                        <td>{{ @$v->date_sold }}</td>
                    </tr>
                @endforeach
                </tbody>
                </tfoot>
            </table>

            <h3 class="section_sub_title">{{ ts('MANAGEWARRANTY') }}</h3>
            <table class="table table-s2 text-center">
                <thead>
                <tr>
                    <th>{{ ts('warrantyid') }}</th>
                    <th>{{ ts('length') }}</th>
                    <th>{{ ts('INSTALLATIONDATE') }}</th>
                </tr>
                </thead>
                <tbody>
                @foreach(\App\Models\WarrantyToVehicleCoverage::where('roll_number', $data->roll_number)->orderByDesc('id')->get() as $v)
                    <tr>
                        <td>{{ @$v->warranty_id }}</td>
                        <td>{{ @$v->length }}</td>
                        <td>{{ @$v->warranty->installation_date }}</td>
                    </tr>
                @endforeach
                </tbody>
                </tfoot>
            </table>
        </div>

    </div>


@endsection